package com.example.lol.ui;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.Scroller;


import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;

import com.example.lol.R;
import com.example.lol.ui.adapter.MeAdapter;
import com.google.android.material.tabs.TabLayout;

public class FifthBottomFragment extends Fragment {
    private MeAdapter meAdapter;
    private TabLayout mTabLayout;
    private ViewPager mViewPager;
    private LinearLayout linearLayout;
    private ScrollView scrollView;
    @RequiresApi(api = Build.VERSION_CODES.M)
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.self_1, container, false);
        scrollView=view.findViewById(R.id.me_srcollview);
        linearLayout=view.findViewById(R.id.me_top_line_2);
       scrollView.setOnScrollChangeListener(new View.OnScrollChangeListener() {
            @Override
            public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
                if(scrollY>=100){

                    linearLayout.setVisibility(View.VISIBLE);
                }else{
                    linearLayout.setVisibility(View.GONE);
                }
            }
        });
        mTabLayout = view.findViewById(R.id.me_tab);
        mViewPager = view.findViewById(R.id.me_view);
        meAdapter = new MeAdapter(getChildFragmentManager());
        mViewPager.setAdapter(meAdapter);
        mTabLayout.setupWithViewPager(mViewPager);
        mTabLayout.setInlineLabel(true);
        return view;

    }
}
